<template>
    <div class="father">
        Father Component
        <Child :moneyF="money" :getSonMoney="GetSon"/>
        <br>
        <!-- sonMoney传值为真显示，sonMoney没传值为假不显示 -->
        <div v-show="sonMoney">Father Money = {{sonMoney}}</div>
    </div>
</template>
<script setup   lang="ts">
import Child from './Child.vue'
import {ref} from 'vue'
let money = ref(1000000);
let sonMoney = ref(0);
//使用函数接收子组件数据
function GetSon(valueF:number){
    sonMoney.value = valueF;
}
/*
总结：props 父传子，属性值是非函数。子传父，属性值是函数。
*/
</script>
<style scoped>
.father{
    width: 100vw;
    background-color: rgb(35, 109, 221);
}
</style>
